﻿/// <reference path="../angular.js" />

var irisApp = angular.module('irisApp', ['ui.router', 'ngAnimate', 'ngval', 'angularTree']);

irisApp.config([
    '$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {

        //$urlRouterProvider.otherwise("/login");

        $stateProvider
            .state('register', {
                url: "/register",
                templateUrl: "/account/register",
                controller: "RegisterController"
            })
            .state('login', {
                url: "/login",
                templateUrl: "/account/login"
            })
            .state('usersManagement', {
                url: "/user",
                templateUrl: "/user/index",
                controller: "UserManagementController"
            }).state('usersManagement.usersList', {
                url: "/usersList/{roleId}",
                templateUrl: "/user/userslist",
                controller: "UserListController"
            }).state('usersManagement.manageUserRoles', {
                url: "/manageuserroles/{userId}",
                templateUrl: "/user/manageuserroles",
                controller: "ManageUserRolesController"
            })
            .state('rolesManagement', {
                url: "/role",
                templateUrl: "/role/index",
                controller: ""
            }).state('rolesManagement.addRole', {
                url: "/addrole",
                templateUrl: "/role/addrole",
                controller: ""
            }).state('permissionManagement', {
                url: "/permission",
                templateUrl: "/permission/index",
                controller: "PermissionController"
            }).state('permissionManagement.changePermissions', {
                url: "/changePermission/{roleId}",
                templateUrl: "/permission/changePermissions",
                controller: "ChangePermissionsController"
            });

    }
]);



irisApp.run(
      ['$rootScope', '$state', '$stateParams',
      function ($rootScope, $state, $stateParams) {

          // It's very handy to add references to $state and $stateParams to the $rootScope
          // so that you can access them from any scope within your applications.For example,
          // <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
          // to active whenever 'contacts.list' or one of its decendents is active.
          $rootScope.$state = $state;
          $rootScope.$stateParams = $stateParams;
      }]);